package com.entity;

/**
 * @author king
 * @date 2022/5/18 - 16:38
 */
public class Recommend {
    private int productId;
    private double score;

    public Recommend() {
    }

    public Recommend(int productId, double score) {
        this.productId = productId;
        this.score = score;
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

//    @Override
//    public int compareTo(Object o) {
//        if(o instanceof Recommend){
//            Recommend recommend=(Recommend) o;
//            //方法一：
//            if(this.score>recommend.score){
//                return 1;
//            }else if(this.score<recommend.score){
//                return -1;
//            }else{//价格相同,按照产品名称从低到高比较
//                return 0;
//                //return this.name.compareTo(goods.name);
//            }
//            //方法二： 推荐
////            return Double.compare(this.price,goods.price);
//        }
//        else {
//            throw new RuntimeException("传入的数据类型不一致");
//
//        }
//    }


//    @Override
//    public int compareTo(Object o) {
////        if(o instanceof Recommend){
////            Recommend recommend=(Recommend) o;
////            //方法一：
////            if(this.score>recommend.score){
////                return 1;
////            }else (this.score<recommend.score){
////
////                return -1;
////            }
////            //方法二： 推荐
//////            return Double.compare(this.price,goods.price);
////        }
////        else {
////            throw new RuntimeException("传入的数据类型不一致");
////        }
//
//
//    }
}
